package com.tsingteng.cosfun.ui.login.report;

import com.tsingteng.cosfun.app.App;
import com.tsingteng.cosfun.bean.BaseDataBean;
import com.tsingteng.cosfun.bean.CommBackBean;
import com.tsingteng.cosfun.bean.PersonBean;
import com.tsingteng.cosfun.bean.ReportBean;
import com.tsingteng.cosfun.callback.RxObserver;
import com.tsingteng.cosfun.http.RxSchedulers;
import com.tsingteng.cosfun.mvp.module.BaseModel;
import com.tsingteng.cosfun.utils.TimeUtils;

import retrofit2.Callback;

/**
 * 描述 :登录上报网络请求层
 * 创建人: 常胜.
 * 时间:2018/8/18
 */
public class ReportModel extends BaseModel implements IReportModel {
    @Override
    public void getReportModel(RxObserver<ReportBean> rxObserver) {
        doRxRequest().getLoginAndReport(App.getDeviceToken(),"1", TimeUtils.getCurTimeLong()+"").compose(RxSchedulers.io_main()).subscribe(rxObserver);
    }

    @Override
    public void gotNotReadCount(RxObserver<ReportBean> rxObserver) {
        doRxRequest().readNotCount().compose(RxSchedulers.io_main()).subscribe(rxObserver);
    }

    @Override
    public void getReadAllMsg(Callback<BaseDataBean<ReportBean>> callback) {
        doRxRequest().readDoneAll().enqueue(callback);
    }

    @Override
    public void getFollowCount(long timestamp, long datetime, RxObserver<CommBackBean> rxObserver) {
        doRxRequest().getFollowCountBean(String.valueOf(timestamp),String.valueOf(datetime)).compose(RxSchedulers.io_main()).subscribe(rxObserver);
    }


}
